import React from 'react'
import {Link} from 'react-router-dom'
import { useSelector ,useDispatch} from 'react-redux'
import * as userFu from '../store/modules/user'
import { countAdd } from '../store/modules/user'
export default function Ddgl() {
const user=  useSelector((state)=>{
      // console.log(state,25678900222);
      return state.user
  })
  const dispatch= useDispatch()
  function changeName(id) {
    // console.log(id);
    dispatch(userFu.nameSet({id:id,name:'王五'}))
  }
  function adds() {
   dispatch(countAdd(4)) 
  }
  // console.log(user,'mn');
    const ss=1233333333
  return (
    <div>
      <div><Link to={`/NavPage/userList/${ss}?a=1&b=2`}>userList</Link></div>
      <div>
        {user.user.map(it=>{
          return <div key={it.id}>姓名： {it.name} <button onClick={()=>changeName(it.id)}>修改</button></div>
        })}
      </div>
      <div>
        {user.count} <button onClick={adds}>add</button>
      </div>
    </div>
  )
}
